package com.server.server.initializer;

import com.server.server.handler.udp.UdpConnectStepOneHandler;
import com.server.server.handler.udp.UdpConnectStepThreeHandler;
import com.server.server.handler.udp.UdpConnectStepTwoHandler;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;

/**
 * @Description: This is a sample class.
 * @Author: Simon
 */
public class UdpShakeHandServerInitializer extends ChannelInitializer<Channel> {

    @Override
    protected void initChannel(Channel ch) throws Exception {

        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(new LoggingHandler(LogLevel.DEBUG));

        // 仿tcp
        // 步骤1: 接收auth的 SYN
        pipeline.addLast("Step1", new UdpConnectStepOneHandler());

        // 步骤2: 响应 SYN-ACK
//        pipeline.addLast("Step2", new UdpConnectStepTwoHandler());

        // 步骤3: 接收auth的 ACK
//        pipeline.addLast("Step3", new UdpConnectStepThreeHandler());


    }
}
